﻿using PHMEE.Entities.DaqInfo.TdDevices;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PHMEE.IRepositories.DaqInfo.TdDevices
{
    /// <summary>
    /// 定义 TdDevicePointRelation 的自定义仓储接口
    /// </summary>
    public interface ITdDevicePointRelationRepository
    {
        /// <summary>
        /// 根据子表实例 ID 获取与之关联的所有测点关系。
        /// </summary>
        /// <param name="tdDeviceInstanceId">子表实例的唯一标识符。</param>
        /// <returns>返回与指定子表实例相关的测点关系列表。</returns>
        Task<List<TdDevicePointRelation>> GetRelationsByInstanceIdAsync(Guid tdDeviceInstanceId);

        /// <summary>
        /// 根据测点ID获取该测点与子表实例的关联关系
        /// </summary>
        /// <param name="pointId">测点的唯一标识符</param>
        /// <returns></returns>
        Task<TdDevicePointRelation> GetRelationByPointIdAsync(Guid pointId);

        /// <summary>
        /// 获取测点与子表实例的关联关系集合。
        /// </summary>
        /// <param name="pointIds">测点集合</param>
        /// <returns></returns>
        Task<List<TdDevicePointRelation>> GetRelationsAsync(List<Guid> pointIds);

        /// <summary>
        /// 保存测点与子表实例的关系。
        /// </summary>
        /// <param name="relation">要插入的测点与子表实例关系对象。</param>
        /// <returns>异步任务。</returns>
        Task AddAsync(TdDevicePointRelation relation);

        /// <summary>
        /// 批量保存测点与子表实例
        /// </summary>
        /// <param name="relations"></param>
        /// <returns></returns>
        Task AddRangeAsync(List<TdDevicePointRelation> relations);

        /// <summary>
        /// 更新测点与子表实例的关系。
        /// </summary>
        /// <param name="relation">要更新的测点与子表实例关系对象。</param>
        /// <returns>异步任务。</returns>
        Task UpdateAsync(TdDevicePointRelation relation);

        /// <summary>
        /// 批量更新测点与子表的关系
        /// </summary>
        /// <param name="relations"></param>
        /// <returns></returns>
        Task UpdateRangeAsync(List<TdDevicePointRelation> relations);

        /// <summary>
        /// 删除指定的测点与子表实例关系。
        /// </summary>
        /// <param name="relation">要删除的测点与子表实例关系对象。</param>
        /// <returns>异步任务。</returns>
        Task DeleteRangeAsync(List<TdDevicePointRelation> relations);
    }
}
